package cn.edu.jxau.framework.dao.core;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;



/**
 * 视图构造器
 * @author Aaron
 *
 */
public class ViewConstructor {
	
	ViewConstructor(){
		
	}
	
	HashMap<String,Object> ConstructView(ResultSet result,HashMap<String, Integer> sQLRelustMapper){
		
		return generateRelust(result, sQLRelustMapper);
		
	} 

	private HashMap<String, Object> generateRelust(ResultSet relust, HashMap<String, Integer> sQLRelustMapper) {
		
		HashMap<String, Object> map = new HashMap<>();
		for (String key : sQLRelustMapper.keySet()) {
			int i = sQLRelustMapper.get(key);
			try {
				map.put(key, relust.getObject(i));
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return map;
	}
	
}
